﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using SYH178Utils;

namespace SYH178DAL
{
    public class Company_SimpeInfo
    {
        public Company_SimpeInfo()
        { }
        #region  BasicMethod 后台代码

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SYH178Model.Company_SimpeInfo GetModel(int UserId)
        {
            SqlParameter[] parameters = {
					new SqlParameter("@UserId", SqlDbType.Int,4)
			};
            parameters[0].Value = UserId;

            SYH178Model.Company_SimpeInfo model = new SYH178Model.Company_SimpeInfo();
            DataSet ds = Common.SqlHelper.ExecuteDataset(Config.SYHConnStr, CommandType.StoredProcedure, "Company_SimpeInfo_GetModel", parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SYH178Model.Company_SimpeInfo DataRowToModel(DataRow row)
        {
            SYH178Model.Company_SimpeInfo model = new SYH178Model.Company_SimpeInfo();
            if (row != null)
            {
                if (row["Id"] != null && row["Id"].ToString() != "")
                {
                    model.Id = int.Parse(row["Id"].ToString());
                }
                if (row["UserId"] != null && row["UserId"].ToString() != "")
                {
                    model.CompanyId = int.Parse(row["UserId"].ToString());
                }
                if (row["Introduction"] != null)
                {
                    model.Introduction = row["Introduction"].ToString();
                }
            }
            return model;
        }

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}
